{% extends "myghtyboard/base.html" %}
{% load i18n %}


{% block extra-title %}{% trans "Forum Index" %} :: {% trans "Topics from" %} "{{ forum.name }}"{% endblock %}

{% block your-position %}
	<a href="/forum/">{% trans "Forum Index" %}</a>
	<span class="color-orange">»</span>
	{{ forum.name }}
{% endblock %}

{% block content %}
	  <div id="page-container">
                        <!-- Lewa kolumna START -->
                            <!-- Kategoria -->
                            <div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>{{ forum.name }}</span>
                                        </span>
                                    </div>
                                    <div class="box-content">
				    {% for topic in topics %}
                                        <div class="line">
                                            <span class="icon-forum">
					        {% if topic.is_locked %}
							    <img src="/site_media/css/gfx/icons/no-posts-white.gif" alt="*" />
						    {% else %}
							    {% if topic.is_sticky %}
								    <img src="/site_media/css/gfx/icons/no-posts-white.gif" alt="*" />
							    {% else %}
								    {% if topic.is_global %}
									    <img src="/site_media/css/gfx/icons/new-posts-white.gif" alt="*" />
								    {% else %}
									    {% if topic.hasNew %}
										<img src="/site_media/css/gfx/icons/new-posts-white.gif" alt="*" />
									    {% else %}
										<img src="/site_media/css/gfx/icons/no-posts-white.gif" alt="*" />
									    {% endif %}
								    {% endif%}
							    {% endif%}
						    {% endif %}  
					    </span>
                                            <span class="content">
                                                <a href="/forum/topic/1/{{ topic.id }}/{% if topic.hasNew %}#post_{{ topic.first_unread.id }}{% endif %}"><strong>{{ topic.name }}</strong></a><br />
                                                <span class="color-gray"><strong>Autor: </strong>{{ topic.first_post.author_system }}</span>
                                            </span>
                                            
					    
					    {% if perms.is_staff %}
                                        <span class="button-border buttons"><span class="button"><a href="/forum/delete_topic/{{ topic.id }}/{{ forum.id }}/" onclick="return confirm('{% trans "Delete this Topic and all Posts?" %}')">{% trans "X" %}</a></span></span>
                                        {% if topic.is_locked %}
						<span class="button-border buttons"><span class="button"><a href="/forum/open_topic/{{ topic.id }}/{{ forum.id }}/" onclick="return confirm('{% trans "Open This Topic?" %}')">{% trans "U" %}</a></span></span>                                                
                                        {% else %}
						<span class="button-border buttons"><span class="button"><a href="/forum/close_topic/{{ topic.id }}/{{ forum.id }}/" onclick="return confirm('{% trans "Close This Topic?" %}')">{% trans "L" %}</a></span></span>
                                        {% endif %}
                                        {% ifnotequal topic.is_locked 1 %}
					  <span class="button-border buttons"><span class="button"><a href="/forum/move_topic/{{ topic.id }}/{{ forum.id }}/">{% trans "&gt;&gt;" %}</a></span></span>
                                         {% endifnotequal %}
                                    {% endif %}
					    <span class="button-border buttons"><span class="button"><a href="/forum/topic/1/{{ topic.id }}/{% if topic.hasNew %}#post_{{ topic.first_unread.id }}{% endif %}">czytaj</a></span></span>
                                            <span class="last-answers">
                                                <strong><a href="/forum/topic/{{ topic.last_post.post_page }}/{{topic.id}}/#post_{{ topic.last_post.id }}">Ostatnia wypowiedź</a></strong><br />
                                                <span class="color-gray">{{ topic.last_post.author_system }}</span> <span class="color-orange">»</span> <span class="color-gray">{{ topic.last_post.date|date:"d/m/Y G:i" }}</span>
                                            </span>
                                        </div>
					{% if not forloop.last %}
                                        <hr />
					{% endif %}
				     {% endfor %}
                                       
                                    </div>
                                </div>
                            </div>
                            <!-- Kategoria Koniec -->
			    {% if perms.add_topic %}
			    <div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>Dodaj szybko nowy temat</span>
                                        </span>
                                    </div>
                                    <div class="box-content">
                                        <form method="post" action="/forum/add_topic/{{ forum.id }}/">
                                            <fieldset>
						<span class="tag-normal color-orange">Tytuł: </span>{{ form.name }}{% if form.name.errors %}<br />*** {{ form.name.errors|join:", " }}{% endif %}
                                                <textarea class="height-60" name="text"></textarea>
						<b>{% trans "Available Tags" %}</b>: [b], [u], [i], [code]. [url], [img], [quote].<hr />
					  {% if perms.is_staff %}
					  <span class="tag-normal color-orange">{% trans "Options" %}</span><br/>
						{{ form.is_sticky }} <label for="id_is_sticky">{% trans "Sticky" %}</label>{% if form.is_sticky.errors %}<br />*** {{ form.is_sticky.errors|join:", " }}{% endif %}<br />
						{{ form.is_global }} <label for="id_is_global">{% trans "Global" %}</label>{% if form.is_global.errors %}<br />*** {{ form.is_global.errors|join:", " }}{% endif %}
					 
					  {% endif %}				      
                                                    <p class="right">
                                                        <span class="button-border">
                                                            <input type="submit" name="save" value="dodaj temat" />
                                                        </span>
                                                    </p>
                                            </fieldset>
                                        </form>
                                    </div>
                                </div>
                            </div>
			    {% endif %}
                        <!-- Lewa kolumna KONIEC -->
                </div>
                <div id="page-container-2">
                            <div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>Uprawnienia</span>
                                        </span>
                                        <span class="box-header-icons">
                                            <img class="box-header-minimize" alt="minimize" src="/site_media/css/gfx/icons/minimize-transparent.png" />
                                            <img class="box-header-close" alt="close" src="/site_media/css/gfx/icons/close-transparent.png" />
                                        </span>
                                    </div>
                                    <div class="box-content">
                                        <p class="line">
						{% if perms.add_topic %}
							<span class="color-orange">{% trans "You <b>can</b> post new Topics" %}</span><br />
						{% else %}
							<span class="color-grey">{% trans "You <b>can't</b> post new Topics" %}</span><br />
						{% endif %}
						{% if perms.add_post %}
							<span class="color-orange">{% trans "You <b>can</b> post new Posts" %}</span><br />
						{% else %}
							<span class="color-grey">{% trans "You <b>can't</b> post new Posts" %}</span><br />
						{% endif %}
						<hr/>
						{% if perms.is_staff %}
							<span class="color-orange">{% trans "You <b>are</b> a Moderator" %}</span><br />
						{% else %}
							<span class="color-grey">{% trans "You <b>aren't</b> a moderator" %}</span><br />
						{% endif %}
                                        </p>                                        
                                    </div>
                                </div>
                            </div>
			    
			    
			<div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>Opcje</span>
                                        </span>
                                        <span class="box-header-icons">
                                            <img class="box-header-minimize" alt="minimize" src="/site_media/css/gfx/icons/minimize-transparent.png" />
                                            <img class="box-header-close" alt="close" src="/site_media/css/gfx/icons/close-transparent.png" />
                                        </span>
                                    </div>
                                    <div class="box-content">
                                        <p class="line">
                                            <span class="content">
						<span class="button"><a href="/forum/add_topic/{{ forum.id }}/">{% trans "Dodaj nowy temat" %}</a></span>
					    </span>

                                        </p>
					<hr/>
					<p class="line">
					    <span class="content">
                                                <span class="button"><a href="/forum/mark_all_read/{{ forum.id }}/">{% trans "Oznacz wszystkie tematy jako przeczytane" %}</a></span>
                                            </span>
					</p>
                                    </div>
                                </div>
                            </div>
			    
                            <!-- Ostatnie tematy -->
                            <div class="box-shadow">
                                <div class="box">
                                    <div class="box-header">
                                        <span class="box-header-title">
                                            <img class="box-header-pointer" alt="pointer" src="/site_media/css/gfx/icons/point-transparent.png" />
                                            <span>Najnowsze tematy na tym forum</span>
                                        </span>
                                        <span class="box-header-icons">
                                            <img class="box-header-minimize" alt="minimize" src="/site_media/css/gfx/icons/minimize-transparent.png" />
                                            <img class="box-header-close" alt="close" src="/site_media/css/gfx/icons/close-transparent.png" />
                                        </span>
                                    </div>
                                    <div class="box-content">
				    {% for topic in hot_topics %}
                                        <p class="line">
                                            <span class="content">
                                                <strong class="tag-normal"><a href="/forum/topic/1/{{ topic.id }}">{{ topic.name }}</a></strong><br />
                                                <span class="color-gray">{{ topic.forum.category.name }}</span> <span class="color-orange">»</span> <span class="color-gray"><a href="/forum/forum/{{ topic.forum.id }}">{{ topic.forum.name }}</a></span>
                                            </span>
                                            <span class="icons">
                                                <a href="/forum/topic/{{ topic.forum.id }}/{{ topic.id }}"><img class="icon-show" alt="show" src="/site_media/css/gfx/icons/show-white.gif" /></a>
                                            </span>
                                        </p>
					{% if not forloop.last %}
                                        <hr />
					{% endif %}
				    {% endfor %}
                                    </div>
                                </div>
                            </div>
                            <!-- Ostatnie tematy KONIEC -->
                            
                            <!-- Prawa kolumna KONIEC -->
                </div>
{% endblock %}
